//
//  CJExten+UINib.swift
//  CJCore
//
//  Created by 陈警卫 on 2024-07-05.
//

import UIKit
import Foundation

public extension UIView {
    
    /// 快捷初始化Nib
    @objc func cj_viewNib(_ name: String?) -> Self? {
        var nibname = name
        if name == nil {
            nibname = NSStringFromClass(Self.self)
        }
        if nibname == nil {
            return nil
        }
        let nibs = Bundle.main.loadNibNamed(nibname!, owner: self)
        let nib = nibs?.first
        return nib as? Self
    }
}
